﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Forums.Domain
{
	public class ForumTotal
	{
		/// <summary>
		/// Gets or sets the topics.
		/// </summary>
		/// <value>The topics.</value>
		public virtual int Topics
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the posts.
		/// </summary>
		/// <value>The posts.</value>
		public virtual int Posts
		{
			get;
			set;
		}

		/// <summary>
		/// Updates the topics.
		/// </summary>
		public virtual void UpdateTopics()
		{
			this.UpdateTopics(1, true);
		}

		/// <summary>
		/// Updates the topics.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <param name="addition">if set to <c>true</c> [addition].</param>
		public virtual void UpdateTopics(int value, bool addition)
		{
			if (addition)
			{
				this.Topics = this.Topics + value;
			}
			else
			{
				this.Topics = this.Topics - value;
			}
		}

		/// <summary>
		/// Updates the posts.
		/// </summary>
		public virtual void UpdatePosts()
		{
			this.UpdatePosts(1, true);
		}

		/// <summary>
		/// Updates the posts.
		/// </summary>
		/// <param name="value">The value.</param>
		/// <param name="addition">if set to <c>true</c> [addition].</param>
		public virtual void UpdatePosts(int value, bool addition)
		{
			if (addition)
			{
				this.Posts = this.Posts + value;
			}
			else
			{
				this.Posts = this.Posts - value;
			}
		}
	}
}